<?php
class model__update_permission_model extends database_mysql
{
    public function __construct()
    {
        parent::__construct();
        
    }
    
    public function md_pu_get_list_action_com()
    {
        
        $sql = "
                SELECT *
                FROM
                ".prefix."com_act

        ";
        $rs = parent::mysql_fetch_all_rows($sql);
        return $rs;
        
    }
    
    public function md_pu_get_list_action()
    {
        
        $sql = "
                SELECT *
                FROM
                ".prefix."actions

        ";
        $rs = parent::mysql_fetch_all_rows($sql);
        return $rs;
        
    }
    
    public function md_pu_get_list_com()
    {
        
        $sql = "
                SELECT DISTINCT
                ".prefix."categories.ID,
                ".prefix."categories.Com
                FROM
                ".prefix."categories
                WHERE
                ".prefix."categories.Define = 'com'
        ";
        $rs = parent::mysql_fetch_all_rows($sql);
        return $rs;
        
    }
    
    public function md_pu_check_permission($com, $action)
    {
        $sql = "
                SELECT * 
                FROM
                ".prefix."permission
                WHERE
                ".prefix."permission.CID = $com AND
                ".prefix."permission.Action = '$action'
        ";
        $rs = parent::mysql_fetch_one_rows($sql);
        return $rs;
    }
    
    public function md_pu_insert($data)
    {
        parent::mysql_insert_array(prefix.'permission', $data);
    }
    

    
}